/**
 * 
 */
package be.jaisy.ui.gwt.client.util;

/**
 * @author Stany Blanvalet
 * 
 */
public class ConvertionHelper {

	public static String convert(String[] messages) {
		if (messages == null)
			return null;
		StringBuffer message = new StringBuffer();
		for (int i = 0; i < messages.length; i++) {
			if (i < messages.length - 1)
				message.append(messages[i] + ",");
			else
				message.append(messages[i]);
		}
		return message.toString();
	}
	
	public static String convert(Long[] messages) {
		if (messages == null)
			return null;
		StringBuffer message = new StringBuffer();
		for (int i = 0; i < messages.length; i++) {
			if (i < messages.length - 1)
				message.append(convert(messages[i]) + ",");
			else
				message.append(convert(messages[i]));
		}
		return message.toString();
	}

	public static String convert(long message) {
		return String.valueOf(message);
	}

	public static String convert(int message) {
		return String.valueOf(message);
	}

	public static String convert(Long message) {
		if (message == null)
			return null;
		return String.valueOf(message);
	}

	public static String convert(Integer message) {
		if (message == null)
			return null;
		return String.valueOf(message);
	}

}
